
#include<stdio.h>
#include<coelacanth/queue.h>

void testfunc(void *q)
{
   queue_ptr(tmp, int);
   tmp = q;

   queue_enqueue(tmp, 3);
   printf("enqueue: %d\n", queue_get_tail(tmp));
}

int main()
{
   queue(queue, int);

   queue_enqueue(queue, 2);
   printf("enqueue: %d\n", queue_get_tail(queue));

   testfunc(queue);

   queue_enqueue(queue, 5);
   printf("enqueue: %d\n", queue_get_tail(queue));

   queue_enqueue(queue, 7);
   printf("enqueue: %d\n", queue_get_tail(queue));

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   queue_enqueue(queue, 11);
   printf("enqueue: %d\n", queue_get_tail(queue));

   queue_enqueue(queue, 13);
   printf("enqueue: %d\n", queue_get_tail(queue));

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   printf("size: %ld\n", queue_size(queue));

   printf("dequeue: %d\n", queue_get_head(queue));
   queue_dequeue(queue);

   puts("destroying");
   queue_free(queue);

   return 0;
}




